UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DcwRVcKFXI2P3wHRAgJ0cTYznZ7xPpt99+Rsej2V1+Y='
WHERE
key_id = 'cb061b85d23f766036ecfc293f8c99632bbe8f74aaac978b96b6d80a091e7a9f'
AND (
token = 'DcwRVcKFXI2P3wHRAgJ0cTYznZ7xPpt99+Rsej2V1+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)