UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E8mMz1hXsxY4zXKTCWGbkWMF+ioqsmsMQoI2UKwU45U='
WHERE
key_id = 'e0a269676a41bfa5c94bd90ab80475def13ae1ed13c0006767a1e7cb98c4cf8e'
AND (
token = 'E8mMz1hXsxY4zXKTCWGbkWMF+ioqsmsMQoI2UKwU45U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)