UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w1aT5WNhgEBtExoJUua/nCCXsN1EK88d8aqoc9osEdA='
WHERE
key_id = 'de59ca69cdb2ccc4e34a6eb8b51da530dbdab1f89c57b5c1a6f6bd2c9665b8a0'
AND (
token = 'w1aT5WNhgEBtExoJUua/nCCXsN1EK88d8aqoc9osEdA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)