UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iQco835cKg4a3nmVh5wmtRfAdPw+/3NoeFYCNqOJsms=' 
WHERE 
  key_id = 'a014d85f4dcbf21fa8e27f2b8765845a1be5df59cd8135caca20a4880e26d347' 
  AND (
    token = 'iQco835cKg4a3nmVh5wmtRfAdPw+/3NoeFYCNqOJsms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031