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

Query time 0.00053