UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2SPE0Q89elSh21FJqLgVttq3Rr1X06CPm5k9d8Dm81E=' 
WHERE 
  key_id = '52e31f22c8e34360fd2fed96cabf3ff3e7eeca09fb7d894b27985b2fccea4b17' 
  AND (
    token = '2SPE0Q89elSh21FJqLgVttq3Rr1X06CPm5k9d8Dm81E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024