UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h0FaKmyV3/J04Vg4Ssgq+LR+XNRYZCk+DD5FuA/9gMc=' 
WHERE 
  key_id = '7195e94cda22c5729cca14a32e976e4c83f81217b0e0f918b6444bcf4b7d9668' 
  AND (
    token = 'h0FaKmyV3/J04Vg4Ssgq+LR+XNRYZCk+DD5FuA/9gMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035