UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BF9QST7cbwoOSyfQOS4vZxitT+RdAZd7ISEmtoyxlL4='
WHERE
key_id = '51989b3fd7697cd12c466b4091b3b9c6c06c851e6127c12c8b0b0b26dc34bae6'
AND (
token = 'BF9QST7cbwoOSyfQOS4vZxitT+RdAZd7ISEmtoyxlL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)