UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gF/+0aI2vrN6sF+t/p9TNGrRlUrybNTCq04siwZ0AKA='
WHERE
key_id = 'cffb977d5035574509b14be824068462c05acdcab456758697b3ab4b66c62e4f'
AND (
token = 'gF/+0aI2vrN6sF+t/p9TNGrRlUrybNTCq04siwZ0AKA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)