UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n160LIuzBnRwRMJBq4C3Camq6tp8GNsAx8Vz9zO21SI=' 
WHERE 
  key_id = 'cf88817a45cf1e1e3ba35cefaa064509be7bb73bb0c6cf6ee046704328ab8462' 
  AND (
    token = 'n160LIuzBnRwRMJBq4C3Camq6tp8GNsAx8Vz9zO21SI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021