UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B6O9bIHjsVz8Exmt9UQMwU/iVNX0t+Czs7Xac4scQ/k=' 
WHERE 
  key_id = 'b12968f3435f7684f4a6e67c2a1c4f7fea03c672abbbbb7c43e0198bf92eaf49' 
  AND (
    token = 'B6O9bIHjsVz8Exmt9UQMwU/iVNX0t+Czs7Xac4scQ/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044