UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TNMXJB0G+LUzDPvAML6th0acKv9mJ7/I/rGVHI8kJBA='
WHERE
key_id = 'f074f6e15afcf83101cf981d2572ecf9fcbf36f5336df4b4d5adee89c1b5e455'
AND (
token = 'TNMXJB0G+LUzDPvAML6th0acKv9mJ7/I/rGVHI8kJBA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)