UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6vl5crrAaVhl18fXnJ8cybUA5zvkfUUX5YRqhAD2LR4='
WHERE
key_id = '3bf77d5aadea07d748189542d18b991e49d8afe0ace1e706ea23bb75077049c9'
AND (
token = '6vl5crrAaVhl18fXnJ8cybUA5zvkfUUX5YRqhAD2LR4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)