UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tmzgdjHGkurElNP6P7YDonJ6AEXJnCf5L1RKvJbo63M='
WHERE
key_id = '371f3a60b05abe100ab1e5d6b25fcdc5c2a05a701beebfd50079dac8806d1665'
AND (
token = 'tmzgdjHGkurElNP6P7YDonJ6AEXJnCf5L1RKvJbo63M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)