UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MHM0rsUjgM+dWGmyu9ofNIVuCu2owmNZFn36xynOXyE=' 
WHERE 
  key_id = '506e26f7939c8d7e2031573993d6951595bfac932b77bdea2f80fc3116da898c' 
  AND (
    token = 'MHM0rsUjgM+dWGmyu9ofNIVuCu2owmNZFn36xynOXyE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035