UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7KIwxHcslrgfBd0p2FlJw+BzFh8wZ9bGIzxRj2+ctsk=' 
WHERE 
  key_id = '272ebc128e85c37ca29558511b6d8f26aefc52889010335c2480c11837f19115' 
  AND (
    token = '7KIwxHcslrgfBd0p2FlJw+BzFh8wZ9bGIzxRj2+ctsk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051