UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3YpAoDA0695SlwmTcxbZu+MRjAeGTsTeXgFIC39hHPs=' 
WHERE 
  key_id = '5c01e981d966c0a0af4aa2d74e1c3d2b634382f7bad0285085aec82e3c924657' 
  AND (
    token = '3YpAoDA0695SlwmTcxbZu+MRjAeGTsTeXgFIC39hHPs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026