UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g7Xz8hkFY9rOrW1/8QIJiLA9ohtoCJfbyMrNKVE39To='
WHERE
key_id = 'd72b0179a4139c860d51996099bf7750b3f9d4d976e0c87771d52c8dcff4c599'
AND (
token = 'g7Xz8hkFY9rOrW1/8QIJiLA9ohtoCJfbyMrNKVE39To='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)