UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cpm2KVBw2YQPOwZ8q2IRDVXA3ZqSyNzV40j+ogLQDT0='
WHERE
key_id = '47d877b5d70f0514ddf1af512357702db375b6ccbb74b5426b524f75bb947eba'
AND (
token = 'Cpm2KVBw2YQPOwZ8q2IRDVXA3ZqSyNzV40j+ogLQDT0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)