UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cGMkhh0ToSossHjT3f4rTNEiIOHZKBVekVfInKwpofs='
WHERE
key_id = '189f31cc981523bd59c4c1362f69014f0c844d6ae2a6bc0c0efd9c5fdd1d5317'
AND (
token = 'cGMkhh0ToSossHjT3f4rTNEiIOHZKBVekVfInKwpofs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)