UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QyGYciPgvt0UckbAYYxg/isRVdxDNtaMXfv6+TOt3Po='
WHERE
key_id = 'e5a7acdf36287d4cc5c1089d9b05c843d8120459b4c3b25b947a1b69d700017c'
AND (
token = 'QyGYciPgvt0UckbAYYxg/isRVdxDNtaMXfv6+TOt3Po='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)