UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OclFVmqfy5uHtcO17LB3LKACxOL3pgbZluzx7Em/VZY='
WHERE
key_id = 'be05387d77805222b41ddb641018cd4195522729a0fa28d27ead6d027b6cdc66'
AND (
token = 'OclFVmqfy5uHtcO17LB3LKACxOL3pgbZluzx7Em/VZY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)