UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nIDUAZUa7BtCzUCj8UOfoOii04WU78qqG17/t0IQTRo='
WHERE
key_id = 'b5bdafb9df9fce788d8cbe2726489570cec09251ce8ded287a67ffa23700eefe'
AND (
token = 'nIDUAZUa7BtCzUCj8UOfoOii04WU78qqG17/t0IQTRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)