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