UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kO8aUi5Gfh63IumMHXZjv1b2/P19mj5Cb/DKpI8rPIU=' 
WHERE 
  key_id = 'fc1d1cff62833232a335e91cf02e2367d9acb13039042be742ce064e6624dc5f' 
  AND (
    token = 'kO8aUi5Gfh63IumMHXZjv1b2/P19mj5Cb/DKpI8rPIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018