UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WZF/gpm6jjvevySjmy0er1VRTte2N+bBYVsBWvyLuRk=' 
WHERE 
  key_id = '709dab5f76336545ba7836e02ad3f17f1a566f8fed923e6c2b1e04beb7308f60' 
  AND (
    token = 'WZF/gpm6jjvevySjmy0er1VRTte2N+bBYVsBWvyLuRk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021