UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Air5/ryxi/sb+nyZEJj+es7SwBJ33l7IGm45/gVemdk=' 
WHERE 
  key_id = '181f9d1eedbdbd7914651452bfb8bd7f8584841677dbe3357c656a82f64bbd3c' 
  AND (
    token = 'Air5/ryxi/sb+nyZEJj+es7SwBJ33l7IGm45/gVemdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034