UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hqip1mhysYiKduvC1qmqWOVvBoYGBBJiKL1JAmdyfQ0='
WHERE
key_id = 'b3d460778fbc86476c7740a0fde7b6e9eeb2c4822dc4aef68e9ac2fb4698c230'
AND (
token = 'hqip1mhysYiKduvC1qmqWOVvBoYGBBJiKL1JAmdyfQ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)