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

Query time 0.00045