UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OiiTdBYjePZk/d+lYpUX4FTnACsFH2PtZlfAIKhj6Ic=' 
WHERE 
  key_id = '104b41a80ca2e26373ed5f356491105ffaa9d39672275f14f5a49d935f91f58f' 
  AND (
    token = 'OiiTdBYjePZk/d+lYpUX4FTnACsFH2PtZlfAIKhj6Ic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034