UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KTppQFrwo36IiKTozMsbMmpxbKKfayGk/PtSzQh/7+M=' 
WHERE 
  key_id = '5e9a3fd1474e6ca54f588865e9b781bee6f2936499757d08989484b6c1969299' 
  AND (
    token = 'KTppQFrwo36IiKTozMsbMmpxbKKfayGk/PtSzQh/7+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053