UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't3EAmPmjVhXkIe65jP75YYiRQkqm1e/6JAgaoMr/kRw='
WHERE
key_id = '6e4da4a09bdf1a180ada89abebf99e432fbf2085c5c50538fd198a82b8d2fe87'
AND (
token = 't3EAmPmjVhXkIe65jP75YYiRQkqm1e/6JAgaoMr/kRw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)