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