UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w0IfRD6jjhVqpahUB4cqgxVs++1iIyw2JY3S6jpl6Q4='
WHERE
key_id = '5695aa65008cb15771b676559870f2f4aaa592e4d902f6448c8b94c0b5069a7b'
AND (
token = 'w0IfRD6jjhVqpahUB4cqgxVs++1iIyw2JY3S6jpl6Q4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)