UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WZtt/ulzyZ0bwnwqM9gsfw8OUvZ3Z+afvfUlxS4sgS0=' 
WHERE 
  key_id = '51ef2110a60c2867768d2be83e6f65a6c628849dea7f46f371cac4b68330188f' 
  AND (
    token = 'WZtt/ulzyZ0bwnwqM9gsfw8OUvZ3Z+afvfUlxS4sgS0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025