UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6gY3AC2nod0ltBWvs57h0xEgHjotaQSRqrqVsJBifr4='
WHERE
key_id = '35f9ff87cbccd9c012bf557cab6b4b89deaa80832c47ec6e6c425a76f8c35ce4'
AND (
token = '6gY3AC2nod0ltBWvs57h0xEgHjotaQSRqrqVsJBifr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)