UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '22IAv3vRZ8bgdn/aWveNxToIKmVNzv0UClh3YDNHuvQ='
WHERE
key_id = '381cb5cb7d401b5e122186b7b0caf7c618a5ab816d283a87f9b6a15317fa9f08'
AND (
token = '22IAv3vRZ8bgdn/aWveNxToIKmVNzv0UClh3YDNHuvQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)