UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yKoB7dV6aZDnflTIzFv6JZ20Rvo+EECrCmCXiRJh6Q4=' 
WHERE 
  key_id = '4f5c7e9d041c430dd0a309059449ba91eb9dd8ecd6c5d8eea85ed3509a91623e' 
  AND (
    token = 'yKoB7dV6aZDnflTIzFv6JZ20Rvo+EECrCmCXiRJh6Q4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026