UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uiVFd4DBKFaQqgE5xgd1X370oEh38nT6CsDNrGMYEKM=' 
WHERE 
  key_id = 'ccca3ae02b278b4b7c799f97421321bad90ac9d74827b8597ffc64a6f4e87459' 
  AND (
    token = 'uiVFd4DBKFaQqgE5xgd1X370oEh38nT6CsDNrGMYEKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047