UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zFsm74efVxG5KT2WgCu4hg2zJnDEdS3YBbF9SLxHTg0=' 
WHERE 
  key_id = '6d581399d46c63ef849f481aa87235debac240657db2e3abe675d5c81b34d6c0' 
  AND (
    token = 'zFsm74efVxG5KT2WgCu4hg2zJnDEdS3YBbF9SLxHTg0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025