UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N+KSYJ10BOarWcE3AWYDm04SdDYunRyOwtlWCd/is4M=' 
WHERE 
  key_id = '25a84cc7b6e06d232ecfc79d4e250d751a97a24b1640aa1cdaf7ef0c45b16c42' 
  AND (
    token = 'N+KSYJ10BOarWcE3AWYDm04SdDYunRyOwtlWCd/is4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021