UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G4oDpmOOzbQdeNdhmCsCeibkadWHvv8nwv3wHUO8nMI='
WHERE
key_id = 'e4734801a265ee9858bc720e43ff27d9525a7b222a75ef6d9294267ce483e1e5'
AND (
token = 'G4oDpmOOzbQdeNdhmCsCeibkadWHvv8nwv3wHUO8nMI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)