UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HLw9Gx5fzYWL17RhW9L6NDMQ8rDSp8LatRmZsWMPpkc=' 
WHERE 
  key_id = '7c580a2ac8da973bba007e613a6f4002218a9d04e2633338b5c9b7b176782518' 
  AND (
    token = 'HLw9Gx5fzYWL17RhW9L6NDMQ8rDSp8LatRmZsWMPpkc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035