UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rt0kblrJ+vkBCLtwar0QSqZ78bCm+6ivSGaNIThsMwU=' 
WHERE 
  key_id = 'e5c39ec557bf7274c3a92cf2298bfcddb8b16ebafe52bdf4901d60c7de4bb42e' 
  AND (
    token = 'rt0kblrJ+vkBCLtwar0QSqZ78bCm+6ivSGaNIThsMwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039