UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rd6uXmUn7rOByHp0c9Kh5hqg/EVnCEFOh5wWz0cI6XA=' 
WHERE 
  key_id = '8b9b8e0754112453a70358f9115bdf01f51a1b15fb4e33ac9045199581d96010' 
  AND (
    token = 'Rd6uXmUn7rOByHp0c9Kh5hqg/EVnCEFOh5wWz0cI6XA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044