UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LuhQkdY6RAed4sCjZa2YbdB54vE7HhscjGU4/KJ8vh8='
WHERE
key_id = 'e8ca9acfd5fff1044b0b732b3767ac7a83c8e6d2614f5f5f96fd60ca02aeb321'
AND (
token = 'LuhQkdY6RAed4sCjZa2YbdB54vE7HhscjGU4/KJ8vh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)