UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bNsnusZAUEWYLpNQ0ZdDbZQURJQpEuPUy3PLaWqB2yA='
WHERE
key_id = '4f7b64389f7a0ed68e93d5f7115a41f297c2d52768a3b68194645af0ccb9353e'
AND (
token = 'bNsnusZAUEWYLpNQ0ZdDbZQURJQpEuPUy3PLaWqB2yA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)