UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JLFfgnOC+EcHxBLPCBRq6tW5XpLr0RDbyDfL55YGRSM=' 
WHERE 
  key_id = '0ad3b7cc21c19edadfd0cdbeed7c4ef593e3d19784b50fcab5bd7f3068f93372' 
  AND (
    token = 'JLFfgnOC+EcHxBLPCBRq6tW5XpLr0RDbyDfL55YGRSM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036