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