UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6u7TrxbEDkRSBhWKHoC2ic8pgbp8/m5w+eIVfNaCdz4=' 
WHERE 
  key_id = 'cf3770a884006070435cc0c143f3c7c4d83011f739362e941903081ca2c69130' 
  AND (
    token = '6u7TrxbEDkRSBhWKHoC2ic8pgbp8/m5w+eIVfNaCdz4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040