UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lupRaBgktgSa5DDGZSeI1dvbl7Lh83aCptosmkAJ0AQ=' 
WHERE 
  key_id = '20952ea31988ac70f6a27bc905dfafd027810674198693d89126ea692961b703' 
  AND (
    token = 'lupRaBgktgSa5DDGZSeI1dvbl7Lh83aCptosmkAJ0AQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039