UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fvU8fPZc+RleusbidqZeXBUCTs2kZ1G1OwjCq5Mi6NY='
WHERE
key_id = 'ec0fc0e3115a99946482cbe2c44da216e250b8da7401e0742de43df38e6d69a7'
AND (
token = 'fvU8fPZc+RleusbidqZeXBUCTs2kZ1G1OwjCq5Mi6NY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)