UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sIOG+ErHIUGjC8g2SCU6dTfjbTXvvKwTx290EI2+TOc='
WHERE
key_id = '148ff24ab47e5ef2c3074464b013e6574c0c385ed3c270392a8e612a30187ec2'
AND (
token = 'sIOG+ErHIUGjC8g2SCU6dTfjbTXvvKwTx290EI2+TOc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)