UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YEw2TzISVdMliscLzBsfq9qjnln0rG5h/cJUqjRiMSQ='
WHERE
key_id = '39d1614cedf227c00d8ffaf510cad4a84a67c135bc664440ea2e0d1e2ecef573'
AND (
token = 'YEw2TzISVdMliscLzBsfq9qjnln0rG5h/cJUqjRiMSQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)